/**
 * Created by meiguizhinian on 2018/7/10
 * Copyright © 2018 lixiaolong. All rights reserved.
 */

//TODO：等待完成

//单例/全静态/枚举
jssupport.UnblockMeSolver = {

	defaultExitOrSize: function (map, exit, size) {
		let emp1 = Object.size(exit)===0 || (exit.x===0 && exit.y===0);
		let emp2 = Object.size(size)===0 || (size.width===0 && size.height===0);

		if (emp1 || emp2) {
			let a = Math.ceil(Math.sqrt(map.length));
			if (a*a!==map.length) {
				return false;
			}
			if (emp1) {
				exit.x = a;
				exit.y = Math.floor(a/2);
			}
			if (emp2) {
				size.width = a;
				size.height = a;
			}
		}
		return true;
	}
};

